import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberRechargeOrderVO, MemberRechargeOrderForm, MemberRechargeOrderQuery } from '@/api/member/MemberRechargeOrder/types';

/**
 * 查询充值订单列表
 * @param query
 * @returns {*}
 */

export const listMemberRechargeOrder = (query?: MemberRechargeOrderQuery): AxiosPromise<MemberRechargeOrderVO[]> => {
  return request({
    url: '/member/MemberRechargeOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询充值订单详细
 * @param rechargeOrderId
 */
export const getMemberRechargeOrder = (rechargeOrderId: string | number): AxiosPromise<MemberRechargeOrderVO> => {
  return request({
    url: '/member/MemberRechargeOrder/' + rechargeOrderId,
    method: 'get'
  });
};

/**
 * 新增充值订单
 * @param data
 */
export const addMemberRechargeOrder = (data: MemberRechargeOrderForm) => {
  return request({
    url: '/member/MemberRechargeOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改充值订单
 * @param data
 */
export const updateMemberRechargeOrder = (data: MemberRechargeOrderForm) => {
  return request({
    url: '/member/MemberRechargeOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除充值订单
 * @param rechargeOrderId
 */
export const delMemberRechargeOrder = (rechargeOrderId: string | number | Array<string | number>) => {
  return request({
    url: '/member/MemberRechargeOrder/' + rechargeOrderId,
    method: 'delete'
  });
};
